package com.qiangqiang.dto;

import lombok.Getter;
import lombok.Setter;

/**
 * Created by q on 2018/2/11.
 */
@Getter
public class TimeDTO {
    private int year;
    private int month;
    private int date;
    private int hourOfDay;
    private int minute;
    private int second;

    public static class Builder{
        private int year;
        private int month;
        private int date;

        //非必要属性
        private int hourOfDay=0;
        private int minute=0;
        private int second=0;

        public Builder(int year, int month, int date) {
            this.year = year;
            this.month = month;
            this.date = date;
        }

        public Builder hourOfDay(int val){
            hourOfDay=val;
            return this;
        }

        public Builder minute(int val){
            minute=val;
            return this;
        }

        public Builder second(int val){
            second=val;
            return this;
        }
        public TimeDTO build(){
            return new TimeDTO(this);
        }
    }
    private TimeDTO(Builder builder){
        year=builder.year;
        month=builder.month;
        date=builder.date;
        hourOfDay=builder.hourOfDay;
        minute=builder.minute;
        second=builder.second;
    }
}
